﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class admin_ManagerCustomer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void GridViewCustomer_SelectedIndexChanged(object sender, EventArgs e)
    {
        int ID = Convert.ToInt32(GridViewCustomer.SelectedValue);
        Response.Redirect("EditCustomers.aspx?ID="+ID);
    }
    protected void ButtonSCustomer_Click(object sender, EventArgs e)
    {
        if (DropDownListSearchUser.SelectedIndex == 0)
        {
            DataSet2TableAdapters.tbl_customerTableAdapter daCustomer = new DataSet2TableAdapters.tbl_customerTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daCustomer.FillByEmail(ds2.tbl_customer, TextBox1.Text);

            DataTable dt = new DataTable();
            dt = ds2.tbl_customer;
            GridViewCustomer.DataSourceID = null;
            GridViewCustomer.DataSource = dt;
            GridViewCustomer.DataBind();
        }
        else if (DropDownListSearchUser.SelectedIndex == 1)
        {
            DataSet2TableAdapters.tbl_customerTableAdapter daCustomer = new DataSet2TableAdapters.tbl_customerTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daCustomer.FillByCusName(ds2.tbl_customer, TextBox1.Text);

            DataTable dt = new DataTable();
            dt = ds2.tbl_customer;
            GridViewCustomer.DataSourceID = null;
            GridViewCustomer.DataSource = dt;
            GridViewCustomer.DataBind();
        }
        else if (DropDownListSearchUser.SelectedIndex == 2)
        {
            DataSet2TableAdapters.tbl_customerTableAdapter daCustomer = new DataSet2TableAdapters.tbl_customerTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daCustomer.FillByID(ds2.tbl_customer, Convert.ToInt32(TextBox1.Text));

            DataTable dt = new DataTable();
            dt = ds2.tbl_customer;
            GridViewCustomer.DataSourceID = null;
            GridViewCustomer.DataSource = dt;
            GridViewCustomer.DataBind();
        }
    }
}
